package com.lujianfei.babymilkmemory.database.table

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "history")
data class HistoryTable(
    @PrimaryKey(autoGenerate = true) val id: Int = 0,
    /**
     * 数据类型
     * 0: 喂奶
     * 1: 拉耙耙
     * 2: 换尿布
     */
    var type: Int,
    /**
     * 创建时间
     */
    var create: Int = 0,
    /**
     * 修改时间
     */
    var update: Int = 0,
    /**
     * 图片路径
     */
    var image: String? = null,
) {
    object Type {
        /**
         * 喂奶
         */
        const val Milk = 0
        /**
         * 拉耙耙
         */
        const val Pee = 1
        /**
         * 尿布
         */
        const val Diaper = 2
    }

    fun getLabel(): String {
        return when (type) {
            Type.Milk -> "喂奶"
            Type.Pee -> "拉耙耙"
            Type.Diaper -> "换尿布"
            else -> "未知"
        }
    }
}
